package demo1;

import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86138
 * Date: 2024-07-19
 * Time: 18:12
 */

class MyArray<T>{
    public Object[] array = new Object[10];


    public void setValue(int pos,T value){
        array[pos] = value;
    }

    public T getValue(int pos){
        return (T) array[pos];
    }

    public void print(){
        System.out.println(Arrays.toString(array));
    }
}

public class Test {
    public static void main1(String[] args) {
        MyArray<Integer> array = new MyArray<>();
        array.setValue(0,1);
        int a = array.getValue(0);

        MyArray<String> array1 = new MyArray<>();
        array1.setValue(1,"gnd");


        array.print();
    }




}



class Solution {
    public int[] plusOne(int[] digits) {
        String s = Arrays.toString(digits);
        int a = Integer.parseInt(s);
        a += 1;
        int b = a;
        int cnt = 0;
        while(b>=0){
            b/=10;
            cnt++;
        }
        int[] array = new int[cnt];
        for(int i=0;i<cnt;i++){
            int c = a%10;
            array[i] = c;
            a/=10;
        }
        return array;
    }
}
